package sury.web.controller.back;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import sury.biz.service.ApplicationFormService;
import sury.biz.service.UserService;
import sury.common.result.Result;
import sury.dal.dto.ApplicationFormDTO;
import sury.dal.entity.ApplicationFormEntity;

/**
 * 后端接口-用户
 */
@RestController
@Slf4j
@RequestMapping("/back/ApplicationForm")
public class UserController {
    @Autowired
    private UserService userService;
    @Autowired
    private ApplicationFormService applicationFormService;

    /**
     * 分页查找用户申请表
     * @param applicationFormDTO
     * @return
     */
    @GetMapping("/page")
    public Result pageApplicationForm(ApplicationFormDTO applicationFormDTO){
        Page<ApplicationFormEntity> page=applicationFormService.pageUser(applicationFormDTO);
        return Result.success(page);
    }

    /**
     * 查看申请表详情
     * @param id
     * @return
     */
    @GetMapping("/detail/{id}")
    public Result detailApplicationForm(@PathVariable("id") Long id){
        return Result.success(applicationFormService.getById(id));
    }

}
